<?php
namespace app\index\controller;
use app\admin\model\Goods;
class Index extends \app\index\controller\BaseIndex{
    public function index(){
        $goods = new Goods();
                                     
        //查询商品特色分类为“新品”的最新四条商品
        $rows = \think\Db::table('pc_goods')
            ->alias('a')
            ->join('pc_goods_classification w','a.id = w.goods_id')
            ->join('pc_goods_attr c','a.id = c.goods_id')
            ->where('is_delete','0')
            ->where('status','1')
            ->where('features','1')
            ->order('w.goods_id desc')
            ->limit(4)
            ->select();
        //查询商品特色分类为“人气”的最新四条商品
        $results = \think\Db::table('pc_goods')
            ->alias('a')
            ->join('pc_goods_classification w','a.id = w.goods_id')
            ->join('pc_goods_attr c','a.id = c.goods_id')
            ->where('is_delete','0')
            ->where('status','1')
            ->where('features','2')
            ->order('w.goods_id desc')
            ->limit(4)
            ->select();
        $data['rows'] = $rows;
        $data['results'] = $results;
        return view('index/index',$data);
    }

}
